from FlagEmbedding import FlagAutoModel
import os
import sys
# 添加父级目录到路径
current_dir = os.path.dirname(os.path.abspath(__file__))
parent_dir = os.path.dirname(current_dir)
sys.path.insert(0, parent_dir)
from my_common import load_model


if __name__ == '__main__':
    model = load_model()
    
    queries = ["律师费5000元", "工资56880元"]
    corpus = ["当事人支付律师费5000元", "当事人正常工作时间工资56880元"]

    # encode the queries and corpus
    q_embeddings = model.encode_queries(queries)
    p_embeddings = model.encode_corpus(corpus)

    # compute the similarity scores
    scores = q_embeddings @ p_embeddings.T
    print(scores)